

#ifndef TOOLSPLUS_H_INCLUDED
#define TOOLSPLUS_H_INCLUDED

#include <wx/wxprec.h>

#ifndef WX_PRECOMP
	#include <wx/wx.h>
#endif

#include <sdk.h>
#include <cbplugin.h> #include "shellproperties.h"
#include "CmdConfigDialog.h"
#include "ShellCtrlBase.h"

class ToolsPlus : public cbPlugin
{
    public:
		
        ToolsPlus();
		
        virtual ~ToolsPlus();

        
        virtual int GetConfigurationPriority() const { return 50; }

        
        virtual int GetConfigurationGroup() const { return cgUnknown; }

		
        virtual cbConfigurationPanel* GetConfigurationPanel(wxWindow* parent);

		
        virtual cbConfigurationPanel* GetProjectConfigurationPanel(wxWindow* , cbProject* ){ return 0; }

		
        virtual void BuildMenu(wxMenuBar* menuBar);

		
        virtual void BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data = 0);

		
        virtual bool BuildToolBar(wxToolBar* ){ return false; }
    protected:
		
        virtual void OnAttach();

		
        virtual void OnRelease(bool appShutDown);


    public:
        void UpdateMenu(bool replace_old_tools);
        void CreateMenu();
        void AddModuleMenuEntry(wxMenu *modmenu,int entrynum, int idref);
        void ShowConsole();
        void HideConsole();
        CommandCollection m_ic; 
    private:
        void OnSettings(wxCommandEvent& event);
        void OnSubMenuSelect(wxUpdateUIEvent& event);
        void OnSetTarget(wxCommandEvent& event);
        void OnSetDirTarget(wxCommandEvent& event);
        void OnSetMultiTarget(wxCommandEvent& event);
        void OnRunTarget(wxCommandEvent& event);
        void OnRunPiped(wxCommandEvent &event);
        void OnShowConsole(wxCommandEvent& event);
        void OnRemoveTerminated(wxCommandEvent& event);
        void OnConfigure(wxCommandEvent& event);
        void OnUpdateUI(wxUpdateUIEvent& event);



        wxMenu *m_ToolMenu;  // pointer to the tools plus menu
        wxMenu *m_OldToolMenu;  // pointer to the original tools menu
        wxMenuBar *m_MenuBar;  // pointer to the main menu bar
        unsigned int m_interpnum;
        unsigned int m_contextactions[10];
        wxString m_wildcard;

        ShellCommandMenuVec m_contextvec;
        ShellCommandMenuVec m_menuvec;

        wxString m_RunTarget;

        // data structures used to pipe console output to a dockable window (m_shellmgr)
        bool m_pipeoutput;
        wxOutputStream *m_ostream; //handle to console program output
        wxInputStream *m_istream; //handle to console program input
        wxProcess *m_pp; // handle to the console program
        wxTimer m_timerpollconsole; //timer object used to regularly poll the piped console program for new output
        // Output from the piped console program held in buffers
        wxString m_outbuf; //contains buffer of streamed output from console
        int m_bufpos; 
        ShellManager *m_shellmgr;
        bool m_ReUseToolsPage;

        DECLARE_EVENT_TABLE();
};

#endif // TOOLSPLUS_H_INCLUDED
